package org.goodsl.mdd.convertor;

import org.goodsl.mdd.ValueConvertor;
import org.goodsl.mdd.ValueOption;

public class BooleanValueConvertor 
		extends ValueConvertor<Boolean>{
	
	private static String[] trueTexts =
		{"true","t","y","yes","1"};
	private static String[] falseTexts =
		{"false","f","n","no","0"};

	@Override
	public Boolean Convert(ValueOption value) {
		String valueText = value.ValueText.toLowerCase();
		for(String v :trueTexts ){
			if(valueText == v) return true;
		}
		for(String v :falseTexts ){
			if(valueText == v) return false;
		}		
		return false;
	}

}
